
// console.log('ok')

function Person(name,age){
    this.name = name
    this.age = age
}

// 实例方法
Person.prototype.say = function(){
    console.log("This is Persion的实例方法")
}

// 静态方法
Person.show = function(){
    console.log("This is Persion的静态方法")
}

const p1 = new Person('王多多',10)
console.log(p1)
console.log("p1.name:"+p1.name)

console.log('======================================')

// 创建一个动物类
class Animal{
    // 这是类中的构造器
    // constructor(){}
    constructor(name,age){
        this.name = name
        this.age = age
    }

    // 静态属性
    static info = "this is a Animal."

    // 实例方法
    say(){
        console.log("This is Animal的实例方法")
    }

    // 静态方法
    static show(){
        console.log("This is Animal的静态方法")
    }
}

const a1 = new Animal("小花",3)
console.log(a1)
console.log("a1.name:"+a1.name)
console.log("info ---> "+Animal.info)